package study.translation.interpreter;

public class NumberParser
{
    public static Number parse( String value )
    {
        if( value.endsWith( "i" ) )
        {
            double num = Double.parseDouble( value.substring( 0, value.length() - 1 ) );
            return new ComplexNumber( 0, num );
        }
        else
        {
            return new RealNumber( Double.parseDouble( value ) );
        }
    }
}
